<extend name="Base/common"/>
<block name="header">
    <include file="Public/nav"/>
</block>
<block name="body">
    <!--推荐模板部分-->
    <div class="container common-block templet">
        <section>
            <header>
                <h1>提交订单</h1>
            </header>


            <div style="padding:10px;font-size: 14px;">
                我的余额:
                <volist name="my_score" id="score">
                    {$score['title']} <span style="color: green;font-weight: bold">{$score['value']}</span> {$score['unit']}  &nbsp; &nbsp; &nbsp; &nbsp;
                </volist>
            </div>


            <div class="clearfix"></div>

            <!-- 插件列表部分-->
            <table width="100%" class="margin-top-15 table">
                <colgroup>
                    <col width="105">
                    <col width="400">
                    <col width="200">
                    <col width="100">

                </colgroup>
                <thead>
                <tr class="first_tr">
                    <th></th>
                    <th>说明</th>
                    <th>可选价格</th>

                </tr>
                </thead>
                <tbody>

                <tr>
                    <td><a href="{:U('moduleDetail',array('id'=>$vo['id']))}"
                           class="app_icon"><b></b>
                        {$goods.cover|display_cover}

                    </a></td>
                    <td>
                        <h3 class="margin-top-0"><a
                                href="{:U('moduleDetail',array('id'=>$goods['id']))}">{$goods.title}</a>
                        </h3>

                        <p class="disrip">{$goods.summary|text|mb_substr=0,20,'utf-8'}</p>

                        <p class="data">版本：{$version.title|display_version=true} 作者：
                            <empty name="goods.author">
                                <a
                                        href="{$goods.user.space_url}">{$goods.user.nickname}</a>
                                <else/>
                                {$goods.author}
                            </empty>
                        </p>
                    </td>
                    <td>
                        <volist name="price" id="price_val">
                          <li style="list-style: none; <if condition="$price_val['pid'] != 0">margin-left:20px;</if>" >
                            <label><input name="change_price" data-role="change_price" data-model="{$price_val['model']}" <if condition="$key eq 0">checked</if> type="radio" value="{$price_val.id}">{$price_val.text}</label>
                          </li>
                        </volist>
                    </td>
                </tr>
                </tbody>
            </table>
            <!-- 插件列表部分-->

            <div class="pull-right" style="padding-bottom: 20px;">
                <div style="font-size: 20px;"> 最终价格：<span id="finally_price" style="color: red"></span></div>

                <form action="__SELF__" method="post">
                    <input name="version_id" type="hidden"  value="{$version.id}">
                    <input name="model" type="hidden"  value="">
                    <input name="price_id" type="hidden" id="price_id" value="">
                    <div class="pull-right"><input class="btn btn-primary" type="submit" value="提交订单"></div>
                </form>

            </div>

        </section>

    </div>

</block>

<block name="script">
<script>
    $(function(){
        var json_price = '{$json_price}';
        json_price = jQuery.parseJSON(json_price);
        var val = $('[data-role="change_price"]').val();
        var model = $('[data-role="change_price"]').attr('data-model');
        $('#finally_price').html(json_price[model][val]);
        $('#price_id').val(val);
        $('input[name="model"]').val(model);

        $('[data-role="change_price"]').change(function(){
            var val = $(this).val();
            var model = $(this).attr('data-model');
            $('#finally_price').html(json_price[model][val]);
            $('#price_id').val(val);
            $('input[name="model"]').val(model);

        })
    })



</script>

</block>